﻿using System.Collections.Generic;
using System.Data.Entity;

namespace Parking.Models
{
    // solo para CODE FIRST pattern
    public class ParkingInitializer : DropCreateDatabaseIfModelChanges<ParkingContext>
    {
        protected override void Seed(ParkingContext context)
        {
            var positions = new List<Position>
                                {
                                    new Position {Number = "1", Location = "Back"},
                                    new Position {Number = "2", Location = "Front"},
                                    new Position {Number = "3", Location = "Middle"}
                                };
            positions.ForEach(d => context.Positions.Add(d));
            base.Seed(context);
        }
    }

    public class ParkingInitializerStart : CreateDatabaseIfNotExists<ParkingContext>
    {
        protected override void Seed(ParkingContext context)
        {
            var positions = new List<Position>
                                {
                                    new Position {Number = "11", Location = "Back"},
                                    new Position {Number = "22", Location = "Front"},
                                    new Position {Number = "33", Location = "Middle"}
                                };
            positions.ForEach(d => context.Positions.Add(d));
            base.Seed(context);
        }
    }
}